package com.ruoyi.project.tencent.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.project.tencent.domain.TcTravelLicenseAuxiliary;
import com.ruoyi.project.tencent.service.ITcTravelLicenseAuxiliaryService;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.page.TableDataInfo;

/**
 * 腾讯云-用户行驶证副页Controller
 * 
 * @author ruoyi
 * @date 2020-06-08
 */
@RestController
@RequestMapping("/tc/travellicenseauxiliary")
public class TcTravelLicenseAuxiliaryController extends BaseController
{
    @Autowired
    private ITcTravelLicenseAuxiliaryService tcTravelLicenseAuxiliaryService;

    /**
     * 查询腾讯云-用户行驶证副页列表
     */
    @PreAuthorize("@ss.hasPermi('tc:travellicenseauxiliary:list')")
    @GetMapping("/list")
    public TableDataInfo list(TcTravelLicenseAuxiliary tcTravelLicenseAuxiliary)
    {
        startPage();
        List<TcTravelLicenseAuxiliary> list = tcTravelLicenseAuxiliaryService.selectTcTravelLicenseAuxiliaryList(tcTravelLicenseAuxiliary);
        return getDataTable(list);
    }

    /**
     * 导出腾讯云-用户行驶证副页列表
     */
    @PreAuthorize("@ss.hasPermi('tc:travellicenseauxiliary:export')")
    @Log(title = "腾讯云-用户行驶证副页", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(TcTravelLicenseAuxiliary tcTravelLicenseAuxiliary)
    {
        List<TcTravelLicenseAuxiliary> list = tcTravelLicenseAuxiliaryService.selectTcTravelLicenseAuxiliaryList(tcTravelLicenseAuxiliary);
        ExcelUtil<TcTravelLicenseAuxiliary> util = new ExcelUtil<TcTravelLicenseAuxiliary>(TcTravelLicenseAuxiliary.class);
        return util.exportExcel(list, "travellicenseauxiliary");
    }

    /**
     * 获取腾讯云-用户行驶证副页详细信息
     */
    @PreAuthorize("@ss.hasPermi('tc:travellicenseauxiliary:query')")
    @GetMapping(value = "/{tlaid}")
    public AjaxResult getInfo(@PathVariable("tlaid") Long tlaid)
    {
        return AjaxResult.success(tcTravelLicenseAuxiliaryService.selectTcTravelLicenseAuxiliaryById(tlaid));
    }

    /**
     * 新增腾讯云-用户行驶证副页
     */
    @PreAuthorize("@ss.hasPermi('tc:travellicenseauxiliary:add')")
    @Log(title = "腾讯云-用户行驶证副页", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TcTravelLicenseAuxiliary tcTravelLicenseAuxiliary)
    {
        return toAjax(tcTravelLicenseAuxiliaryService.insertTcTravelLicenseAuxiliary(tcTravelLicenseAuxiliary));
    }

    /**
     * 修改腾讯云-用户行驶证副页
     */
    @PreAuthorize("@ss.hasPermi('tc:travellicenseauxiliary:edit')")
    @Log(title = "腾讯云-用户行驶证副页", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TcTravelLicenseAuxiliary tcTravelLicenseAuxiliary)
    {
        return toAjax(tcTravelLicenseAuxiliaryService.updateTcTravelLicenseAuxiliary(tcTravelLicenseAuxiliary));
    }

    /**
     * 删除腾讯云-用户行驶证副页
     */
    @PreAuthorize("@ss.hasPermi('tc:travellicenseauxiliary:remove')")
    @Log(title = "腾讯云-用户行驶证副页", businessType = BusinessType.DELETE)
	@DeleteMapping("/{tlaids}")
    public AjaxResult remove(@PathVariable Long[] tlaids)
    {
        return toAjax(tcTravelLicenseAuxiliaryService.deleteTcTravelLicenseAuxiliaryByIds(tlaids));
    }
}
